<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>测试数据生成器</title>
  <link rel="stylesheet" href="/static/css/bootstrap.css">
</head>

<body>
  <div class="container-fluid">
    <div class="row">
      <div class="col-3">
        <!-- 生成文本 -->
        <form class="mt-3" action="/api/test/text" method="post">
          <div class="input-group">
            <input type="text" class="form-control" placeholder="长度" name="size" required>
            <button class="btn btn-outline-secondary" type="submit">生成文本</button>
          </div>
        </form>
        <!-- 生成表情 -->
        <form class="mt-3" action="/api/test/emoji" method="post">
          <div class="input-group">
            <input type="text" class="form-control" placeholder="长度" name="size" required>
            <button class="btn btn-outline-secondary" type="submit">生成表情</button>
          </div>
        </form>
        <!-- 转时间戳 -->
        <form class="mt-3" action="/api/test/timestamp" method="post">
          <div class="input-group">
            <input type="text" class="form-control" placeholder="时间" name="date_time">
            <button class="btn btn-outline-secondary" type="submit">转时间戳</button>
          </div>
        </form>
        <!-- 生成文件 -->
        <form class="mt-3" action="/api/test/file" method="post">
          <div class="input-group">
            <input type="text" class="form-control" placeholder="名称" name="name" required>
            <input type="text" class="form-control" placeholder="大小" name="size" required>
            <button class="btn btn-outline-secondary" type="submit">生成文件</button>
          </div>
        </form>
      </div>
      <div class="col-9">
        <table class="table mt-2">
          <thead>
            <tr>
              <th>ID</th>
              <th>类型</th>
              <th>参数</th>
              <th>内容</th>
            </tr>
          </thead>
          <tbody>
            {% for test_data in test_datas %}
            <tr>
              <th>{{ test_data.id }}</th>
              <td>{{ test_data.type }}</td>
              <td>{{ test_data.arg }}</td>
              <td>
                {% if test_data.type != 'file' %}
                {{ test_data.data }}
                {% else %}
                <a href="/file/{{ test_data.id }}">下载</a>
                {% endif %}
              </td>
            </tr>
            {% endfor %}
          </tbody>
        </table>
      </div>
    </div>
  </div>
  <div class="modal fade" tabindex="-1">
    <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <h5 class="modal-title">错误</h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
        <div class="modal-body">
          <p class="text-danger"></p>
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
        </div>
      </div>
    </div>
  </div>
<script src="/static/js/jquery-3.6.1.js"></script>
<script src="/static/js/bootstrap.js"></script>
<script src="/static/js/index.js"></script>
</body>

</html>